home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / textbo_1 / frm0.frm (.txt) next >
Encoding:
Visual Basic Form  |  1999-07-28  |  2.7 KB  |  95 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "cd tray open/close"
  4.    ClientHeight    =   930
  5.    ClientLeft      =   60
  6.    ClientTop       =   345
  7.    ClientWidth     =   3240
  8.    LinkTopic       =   "Form1"
  9.    MaxButton       =   0   'False
  10.    ScaleHeight     =   930
  11.    ScaleWidth      =   3240
  12.    StartUpPosition =   3  'Windows Default
  13.    Begin VB.CommandButton Command1 
  14.       Caption         =   "&Info"
  15.       Height          =   615
  16.       Left            =   1680
  17.       TabIndex        =   2
  18.       Top             =   120
  19.       Width           =   1215
  20.    End
  21.    Begin VB.CommandButton cmdClose 
  22.       Caption         =   "&Close"
  23.       Height          =   615
  24.       Left            =   240
  25.       TabIndex        =   1
  26.       Top             =   120
  27.       Width           =   1215
  28.    End
  29.    Begin VB.CommandButton cmdOpen 
  30.       Caption         =   "&Open"
  31.       Height          =   615
  32.       Left            =   240
  33.       TabIndex        =   0
  34.       Top             =   120
  35.       Width           =   1215
  36.    End
  37. Attribute VB_Name = "Form1"
  38. Attribute VB_GlobalNameSpace = False
  39. Attribute VB_Creatable = False
  40. Attribute VB_PredeclaredId = True
  41. Attribute VB_Exposed = False
  42. Private Sub Command1_Click()
  43. frmAbout.Show
  44. End Sub
  45. Private Sub Form_Load()
  46. SendMCIString "close all", False
  47. cmdClose.Visible = False
  48. If (App.PrevInstance = True) Then
  49.     End
  50. End If
  51. fCDLoaded = False
  52. If (SendMCIString("open cdaudio alias cd wait shareable", True) = False) Then
  53.     End
  54. End If
  55. SendMCIString "set cd time format tmsf wait", True
  56. End Sub
  57. Private Sub Form_Unload(Cancel As Integer)
  58. 'Close all MCI devices opened by this program
  59. SendMCIString "close all", False
  60. End Sub
  61. Private Function SendMCIString(cmd As String, fShowError As Boolean) As Boolean
  62. Static rc As Long
  63. Static errStr As String * 200
  64. rc = mciSendString(cmd, 0, 0, hWnd)
  65. If (fShowError And rc <> 0) Then
  66.     mciGetErrorString rc, errStr, Len(errStr)
  67.     MsgBox errStr
  68. End If
  69. SendMCIString = (rc = 0)
  70. End Function
  71. ' Open the CD Tray
  72. Private Sub cmdopen_Click()
  73. SendMCIString "set cd door open", True
  74. cmdClose.Visible = True
  75. cmdClose.Default = True
  76. End Sub
  77. Private Sub cmdclose_click()
  78. 'Close the CD Tray
  79. ' This Sub will also show the "CLOSE"
  80. 'button instead of the "OPEN" button.
  81. SendMCIString "set cd door closed", True
  82. cmdClose.Visible = False
  83. cmdClose.Default = False
  84. cmdOpen.Default = True
  85. End Sub
  86. '**************************************
  87. 'CD Rom Open/Close
  88. 'by: heresy on july 28, 1999
  89. 'created with visual basic 6.0
  90. 'compatible with: unknown
  91. 'have fun. and once again: PLEASE help
  92. 'us figure out the multiple drive situation.
  93. '----
  94. '~heresy
  95.